Your First Python Program

After installing Python successfully, the next step is to write and run your first Python program. Traditionally, the first program written in any programming language is called the “Hello, World!” program.

Your first Python Program

1. Writing Your First Program

Open IDLE, Command Prompt, Terminal, or any code editor and write the following code:

print("Hello, World!")

This is the simplest Python program.

2. Understanding the print() Function

The print() function is used to display output on the screen.

In the program:

When Python executes this program, it displays:

Hello, World!

This means Python has successfully executed your first program.

3. How Python Executes a Program

Python is an interpreted language. This means:

For example:

print("Hello")
print("Babu")

Output:

Hello
Babu

Python executes the first line, then the second line in order.

4. Rules for Writing Python Code

5. Why “Hello, World!” is Important

This small program confirms:

It marks the beginning of your programming journey.